# Old Photo Restoration and Colorization-API Integration
Implement old photo restoration and colorization using AI.
# Task Creation
Create an algorithm task based on the input parameters and return the task id
# Request Address
/v3/pic/oic/batch
# Request Parameter
Method
post
Header
Field | Required | Type | Value | Description |
---|---|---|---|---|
Content-Type | YES | string | application/json | |
Authorization | YES | string | Basic xxxxxxxxx | Basic base64 (appkey:appsecret) created by users combining appkey and secret |
Body
Field | Required | Type | Value | Description |
---|---|---|---|---|
images | YES | string[] | Up to 20 images awaiting processing (Downloadable image file link) | |
repair_type | YES | number | Type int, 1. Return one restored photo, 2. Return three colorized photos, 3. Return one restored photo plus three colorized and restored photos. | |
priority | YES | integer | Priority, range [0,9] |
Sample Code
{
"images": [
"Downloadable image file link",
"Downloadable image file link"
],
"repair_type": 1,
"priority": 1
}
# Input File Restriction
Image Format | Image File Size | Image Resolution | Image Aspect Ratio |
---|---|---|---|
PNG JPG JPEG BMP | No more than 50 MB | Greater than 256x256px, less than 5000x5000px | Aspect ratio within 4:1 |
# Return Data
Body
Field | Son Field | Required | Type | Value | Description |
---|---|---|---|---|---|
code | - | YES | number | Status Code | |
msg | - | YES | string | Request Information | |
data | - | YES | object | Response Data | |
- | task_id | YES | string | Task id |
Sample Code
{
"code": 0,
"msg": "",
"data": {
"task_id": "6a4eab77-be30-430a-bf0e-3048042a34ef"
}
}
# Result Acquisition
Request task processing result based on task id
# Request Address
/v3/pic/oic/result/{task_id}
# Request Parameter
Method
get
Path Parameter
Field | Son Field | Required | Type | Value | Description |
---|---|---|---|---|---|
task_id | - | YES | string | Task id |
# Return Data
Body
Field | Son Field | Grandson Field | Required | Type | Value | Description |
---|---|---|---|---|---|---|
code | - | - | YES | number | Status Code | |
msg | - | - | YES | string | Request Information | |
data | - | - | YES | object | Response Data | |
- | status | - | YES | string | Task Status: 1- Waiting; 2 - In progress; 3 - Task complete; 4 - Task failure; 5 - Task closed; 6 - Task timed out | |
- | wait_time | - | YES | string | The waiting time before the next request, with unit of s | |
- | list | - | YES | object[] | Result list | |
- | - | image_result | YES | string | Processed image URL, multiple images will be returned as a concatenated string connected by commas. | |
- | - | status | YES | string | Process Status | |
- | - | reason | YES | string | Cause of failure |